home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / art&graf.ix / art-4543 / mvg / mod_code / mod_info.txt < prev    next >
Text File  |  1987-04-21  |  6KB  |  148 lines

  1.    A Module has two ways to obtain information from MVG 1.3
  2.  Any method can be used alone. Most can be mixed and matched,
  3.  although at this time I don't know why you should bother.
  4.  
  5.  
  6.  
  7. 1) Manual contruction: this is the original method as used in MVG v1.2
  8.                        It requires that you copy the Packet Table from
  9.                        MVG's data space into your module. The Packet
  10.                        is a bit disorganized, mixing varibles' addresses
  11.                        with subroutine entry points; but it is kept
  12.                        to maintain compatiblity with v 1.2.
  13.  
  14. 2) Minimal Hassle:     a set of function calls using a method
  15.                        similar to that used in GEMDOS calls.
  16.  
  17.  
  18.  
  19.  
  20.   All methods require that the module can locate its parent's basepage
  21.  address, and thereby locate the parent's command line (basepage+$0080).
  22.  
  23.  
  24. MVG's commandline will contain the following 3 items, each is four bytes wide
  25.  
  26.    a) Packet Address      32 bit word:   $nnnnnnnn
  27.    b) MVG Signature       ascii codes:   $00, $4D, $56, $47    ( 0,"MVG")
  28.    c) Version signature   ascii codes:   $31, $2e, $30, (??)   ("1.3",??)
  29.    
  30.    
  31.    a) Address of Packet List: THIS IS WHERE YOU'LL FIND THE GOODIES!
  32.    b) MVG Signature must be located!
  33.    c) sub signature denotes version number. last char is sub_ver letter.
  34.    
  35.  
  36.  
  37. Packet List Pointer  (item #a, in MVG commandline)
  38.  
  39.   This address points to the original Packet List (as defined in v1.2).
  40.   Each item in the list is 4 bytes wide (ie a long word). Items are
  41.   either a variables address in MVG's space or the entry point for a
  42.   subroutine within MVG.
  43.   
  44.   The first two items do not follow the above definition. They are direct!
  45.   
  46.   item 0: MAIN_BUFFER Address. This is a pointer to the main image buffer.
  47.           Unlike the other items which can be modified, this one cannot.
  48.  
  49.   item 1: BUFFER_LEN  Variable. This is the size, in bytes, of the above
  50.           addressed buffer. This, also, cannot be modified.
  51.  
  52.   All other items are POINTERS to either Variables or Routines. You can
  53.   modify the value found at the item's directed address:
  54.  
  55.   
  56.   -------------------------------------------------------------------------
  57.   Sample Sample  Sample Sample  Sample Sample  Sample Sample  Sample Sample
  58.   -------------------------------------------------------------------------
  59.   
  60.   Item #z:  Image_Height.W :  $002CE428
  61.   
  62.        at address $002CE428 is where you'll find the Height of the current
  63.        image in memory. 
  64.        
  65.        at $002CE428 we find the value $0190   (400 decimal)
  66.        we can reduce the image's height by simply replacing the $0190
  67.        with a smaller value. When MVG regains control, it will think
  68.        that the image is shorter.
  69.  
  70.  
  71.   Item #e:  AnyKey         :  $00301990
  72.   
  73.        address $00301990 is the entrypoint for the subroutine ANYKEY
  74.        calling this address (ANYKEY) will wait for a keypress and 
  75.        return the keycode in D0.L ; you can use it for input or simply
  76.        as a pausing method.
  77.        
  78.   -------------------------------------------------------------------------
  79.  
  80.  
  81.  
  82.  
  83.  The Packet List Pointer, as said earlier, points to the start of the Packet.
  84.  Each item is an offset from this start (item_number * 4).
  85.  
  86.  At offset -4 is the address for method#2 calls   (PACK2_FUNC)
  87.  At offset -8 is the address for method#3 calls   (not implemented in 1.3)
  88.  At offset -12 is the address of MOD_RETURN_VALUES_INT   (unused in 1.3)
  89.  At offset -16 is the address of MOD_RETURN_VALUES_ADR   (unused in 1.3)
  90.  
  91.  
  92.    Method #1 requires that your module copy the packet list into it's own
  93.  memory space and build it's own method of accessing the values there (or
  94.  contantly accessing MVG's packet area via an indirect pointer).
  95.    There are samples in the MOD_CODE folder, showing how to read MVG's info
  96.  and call it's subroutines. A Number of macros also provide for ease of use.
  97.  The Packet Listing is documented there.
  98.  
  99.   Method #2 incorporates a simple "function call" to perform a specific task
  100.  This is much the same way that GEMDOS calls are made, except that MVG is 
  101.  not called using the TRAP opcode. Instead, JSR to PACK2_FUNC :
  102.  
  103.   -------------------------------------------------------------------------
  104.   Sample Sample  Sample Sample  Sample Sample  Sample Sample  Sample Sample
  105.   -------------------------------------------------------------------------
  106.  
  107.  
  108.    move.l #2,-(sp)            ;function #2, (get main_buffer address)
  109.    move.l PACK2_FUNC,(a0)     ;point to function method address
  110.    jsr (a0)                   ;call MVG Function dispatcher
  111.    addq.l #4,sp               ;restore stack_ptr
  112.    move.l d0,buffer_ptr       ;save address of image buffer
  113.    move.l d1,buffer_len       ;and also it's length
  114.    
  115.   Each function is specified by a number. See M_METH2 file for
  116.   functions details.
  117.   
  118.   
  119.        
  120.        
  121.   -------------------------------------------------------------------------
  122.  
  123.  
  124.  Logical steps for module construction:
  125.  
  126.  
  127.  
  128.  1) INIT
  129.     a) do standard prog init with free_mem etc
  130.     b) store pointer to "parent's" commandline. Label: PAR_whatever
  131.     c) check for MVG signature in parent commandline
  132.        1) if no sig, then exit
  133.        2) if sig found
  134.           a) check version number if necessary
  135.           b) or skip to packet read
  136.  
  137.  2) PACKET Pointers
  138.     a) for method two, simply store the MVG_FUNC pointer somewhere...
  139.     b) for method one, copy the packet listing into module memory...
  140.     
  141.  3) Build or point to necessary routines or system variables
  142.     a) most often, store adrs of main image buffer 
  143.     b) 2nd most often, store adrs of clipboard buffer
  144.     c) other common vars: WID,HGT etc
  145.     
  146.  4) Your program's MAIN_ACTION...........
  147.  
  148.